
var user_id = '';  //旅客id号
var ddcode = '';   //订房订单号
var thisdingdans;  //表单父div
var insertORupdate; //插入或更新
var is_romm = true;  //空房



var bgcolor = new Array();
    bgcolor['kongfang'] = 'url(../images/111.png) repeat-x';   //控房颜色
    bgcolor['qkzf'] = '#0000ff';       //全款支付颜色
    bgcolor['djzf'] = '#ff0000';       //订金支付颜色
    bgcolor['gz'] = '#00ffff';         //挂账颜色
    bgcolor['bt'] = '#ffff00';         //住半天颜色


       //按时间段刷新浏览器
       function loca_href(){

            var zstartdate = $('input[name=zstartdate]').val();
            var zenddate = $('input[name=zenddate]').val();

            location.href = 'yuding.php?zstartdate='+zstartdate+'&zenddate='+zenddate;

       }




          //show右键菜单
          function showyjcd(event,obj){
                var Event = event||window.event;

                var thisObj = $(obj);

                var uid = thisObj.attr('uid');

                var yjcd = $('#yjcd');
                var atag = yjcd.find('a');
                var a_href = atag.attr('href');
                var a_href = a_href.replace(/\?.*/i,'');
                    atag.attr('href',a_href+'?uid='+uid);

                $('#yjcd').css({'left':Event.clientX+10,'top':Event.clientY+10}).show();
                return false;
          }



           //添加旅客
           function showuseradd(){

                 jQuery('#adduser').css("left","10px").css("top","10%").fadeIn("normal");
           }



			function showdd(thisObj){

              insertORupdate = 'insert';
              $('#iframediv').hide();

              var dingdans = $('.dingdans');
                  dingdans.each(function(i){
                       if(i>0){
                           $(this).remove();
                       }else{
                         $(this).find('select[name=rcode]').find('option[value=""]').attr('selected','selected');
                         $(this).find('input[name=bcdd]').show();

                         var thisinps = $(this).find('input[type=text]');
                         thisinps.each(function(i){
                             if($(this).attr('name') != 'chulimeb') $(this).val('');
                         });
                       }
                  });


		       jQuery('.dingdan').css("left","10px").css("top","10%").fadeIn("normal");


                var thisObj = $(thisObj);
                //获取旅客信息

               var uid = thisObj.attr('uid');
               if(uid){
                 user_id = uid;
               }else{
                 user_id = '';
               }

                var user = thisObj.attr('user');
                var idcode = thisObj.attr('idcode');
                var sex = thisObj.attr('sex');
                var age = thisObj.attr('age');
                var tel = thisObj.attr('tel');
                var bak = thisObj.attr('bak');

                $('#ddss').html(user);
                $('#ddzj').html(tel);
			}

            //保存旅客信息
            function saveuser(){

               var lvkexxform = $('form[name=lvkexx]');
               var user = lvkexxform.find('input[name=user]').val();
               var age = lvkexxform.find('input[name=age]').val();
               //var ddcode = lvkexxform.find('select[name=ddcode]').val();//订单号
               var sex = lvkexxform.find('select[name=sex]').val();
               var idcode = lvkexxform.find('input[name=idcode]').val();
               var tel = lvkexxform.find('input[name=tel]').val();
               var bak = lvkexxform.find('textarea[name=bak]').val();

               if(user == ''){
                   alert('请填写姓名');
                   return false;
               }

               if(tel == ''){
                   alert('请填写手机号码');
                   return false;
               }

               var flct = $('#flct');
               var ul = "<ul onclick='member.showdd(this);' user='"+user+"' idcode='"+idcode+"' sex='"+sex+"'  age='"+age+"'  tel='"+tel+"' bak='"+bak+"'><li class='user' val='"+user+"' ><div class='floT' >"+user+"</div></li><li class='zhengjian' val='"+tel+"'>"+tel+"</li><li>预定</li><li style='border-right:none;'>未结款</li></ul>";

               flct.append($(ul));

               $.post('savedata.php',"addtype=user&user="+user+"&age="+age+"&sex="+sex+"&idcode="+idcode+"&tel="+tel+"&bak="+bak,function(id){
                      user_id = id;
                      alert('保存成功');
               });

               jQuery('#adduser').fadeOut("normal");
            }



        function select_zffs(obj){

           var thisObj = $(obj);
           var thisval = $.trim(thisObj.val());
           var thisform = thisObj.parent().parent().parent();
           switch(thisval){
               case '旅行社代收' :
                     thisform.find('div[class=lxsds]').css('display','block');
                     thisform.find('div[class=qtzf]').css('display','none');
                     thisform.find('div[class=djzf]').css('display','none');
                    break;
               case '前台现付' :
                     thisform.find('div[class=lxsds]').css('display','none');
                     thisform.find('div[class=qtzf]').css('display','block');
                     thisform.find('div[class=djzf]').css('display','none');
                    break;

               case '定金支付' :
                     thisform.find('div[class=lxsds]').css('display','none');
                     thisform.find('div[class=qtzf]').css('display','none');
                     thisform.find('div[class=djzf]').css('display','block');
                    break;
           }

        }


       //选择旅行社
       function selectlxs(obj){
           var thisObj = $(obj);
           var thisval = thisObj.val().split('|');
               thisObj.parent().next().find('input[name=yudingmeb]').val(thisval[1]);
       }


       //判断入住日期是否小于退房日期
       function isDayOrder(startdate,enddate){

                    var aDate = startdate.split("-");
                    var oDate1 = new Date(aDate[0],aDate[1]-1,aDate[2],0,0,0).getTime();

                    var bDate = enddate.split("-");
                    var oDate2 = new Date(bDate[0],bDate[1]-1,bDate[2],0,0,0).getTime();

                    if(oDate1 > oDate2){
                       return false;
                    }else{
                       return true;
                    }

       }





         //计算房价
         function jjjg(thisObj){

               var thisObj = $(thisObj);
               thisdingdans = thisObj.parent().parent().parent().parent();

               var dingfang = thisdingdans.find('form[name=dingfang]');

               var rcode = dingfang.find('select[name=rcode]').val();
               if(!rcode){
                  alert('请选择房间');
                  return false;
               }

               var startdate = dingfang.find('input[name=startdate]').val();
               if(!startdate){
                  alert('请选择入住日期');
                  return false;
               }
               var enddate = dingfang.find('input[name=enddate]').val();
               if(!enddate){
                  alert('请选择退房日期');
                  return false;
               }

               if(!isDayOrder(startdate,enddate)){
                   alert('入住日期小于退房日期!!!');
                   return false;
               }



               var rcode_id = dingfang.find('select[name=rcode]').find('option[value='+rcode+']').attr('rcodeid');

              $.post('selectmoney.php',"bdid="+rcode_id+"&startdate="+startdate+"&enddate="+enddate,function(data){
                       var data = eval('('+data+')');

                       var jjia = Number(data['moneys'])/Number(data['num']);

                       var caiwuform = thisdingdans.find('form[name=caiwu]');
                       var xxjg = caiwuform.find('input[name=xxjg]').val(jjia);
                       var xxdays = caiwuform.find('input[name=xxdays]').val(data['num']);
                       var zxxjg = caiwuform.find('input[name=zxxjg]').val(data['moneys']);
                       var xsjg = caiwuform.find('input[name=xsjg]').val(jjia);
                       var xsdays = caiwuform.find('input[name=xsdays]').val(data['num']);
                       var zxsjg = caiwuform.find('input[name=zxsjg]').val(data['moneys']);

              });

         }




           function savedingfang(thisdingdans){


              if(user_id == ''){
                 alert('未保存旅客信息');
                 return false;
              }

              // var thisObj = $(thisObj);
              // thisdingdans = thisObj.parent().parent().parent().parent();



               var dingfang = thisdingdans.find('form[name=dingfang]');
               var yddate = dingfang.find('input[name=yddate]').val();  //预订时间
               var lxs = dingfang.find('select[name=lxs]').val();       //旅行社
               var rtype = dingfang.find('select[name=rtype]').val();   //房型
               var rcode = dingfang.find('select[name=rcode]').val();   //房号
               var num = dingfang.find('input[name=num]').val();        //人数
               var cnum = dingfang.find('input[name=cnum]').val();      //成人数
               var ernum = dingfang.find('input[name=enum]').val();      //儿童数
               var startdate = dingfang.find('input[name=startdate]').val();   //入住日期
               var enddate = dingfang.find('input[name=enddate]').val();       //退房日期
               var lxs = dingfang.find('select[name=lxs]').val().split('|')[0]; //旅行社
               var yudingmeb = dingfang.find('input[name=yudingmeb]').val();   //业务员
               var chulimeb = dingfang.find('input[name=chulimeb]').val();     //处理员


               //插入订房订单
               if(insertORupdate == 'insert'){
               //查询是否是空房
                 var iDays = DateDiff(startdate,enddate);

                 $.ajax({
                   type:'get',
                   data:'startdate='+startdate+'&rcode='+rcode+'&iDays='+iDays,
                   async:false,
                   url:'select_kf.php',
                   success:function(data){
                            if(data == '0'){
                                alert('没有空房,请重新选择时间或房号');
                                is_romm = false;
                            }else{
                                is_romm = true;
                            }
                   }
                 });


               if(!is_romm) return false;

                 ddcode = new Date().valueOf();
                 thisdingdans.find('span[name=ddcode]').html(ddcode);

                 $.post('savedata.php',"addtype=room&bdid="+user_id+"&yddate="+yddate+"&rtype="+rtype+"&rcode="+rcode+"&num="+num+"&cnum="+cnum+"&enum="+ernum+"&startdate="+startdate+"&enddate="+enddate+"&lxs="+lxs+"&yudingmeb="+yudingmeb+"&chulimeb="+chulimeb+"&ddcode="+ddcode,function(id){
                      //ddcode = id;
                 });


              //更新订房订单
              }else if(insertORupdate == 'update'){
                 if(!is_romm) return false;
                 ddcode = $.trim(thisdingdans.find('span[name=ddcode]').html());

                 $.post('updd.php',"addtype=room&bdid="+user_id+"&yddate="+yddate+"&rtype="+rtype+"&rcode="+rcode+"&num="+num+"&cnum="+cnum+"&enum="+ernum+"&startdate="+startdate+"&enddate="+enddate+"&lxs="+lxs+"&yudingmeb="+yudingmeb+"&chulimeb="+chulimeb+"&ddcode="+ddcode,function(id){
                 });

              }


               return [rcode,startdate,enddate];

           }


           //保存财务信息(订房)
           function savecaiwu(thisObj){

                    thisdingdans = $(thisObj).parent().parent().parent().parent();

                    var thisObj =$(thisObj);
                    var thisform = thisObj.parent().parent();
                    var zffs = thisform.find('select[name=zffs]').val();

                    switch($.trim(zffs)){
                     case '旅行社代收' :
                      var zxxjg = thisform.find('div[class=lxsds]').find('input[name=zxxjg]').val();
                      var xxjg  = thisform.find('div[class=lxsds]').find('input[name=xxjg]').val();
                      var xxdays = thisform.find('div[class=lxsds]').find('input[name=xxdays]').val();
                      if(!zxxjg){
                         alert('未填写价格');
                         return false;
                      }

                     if(insertORupdate == 'insert'){

                          var data = savedingfang(thisdingdans);//保存财务(订房)信息
                          if(!is_romm) return false;
                          $.post('savedata.php',"addtype=dfcaiwu&bdid="+user_id+"&ddcode="+ddcode+"&zffs="+zffs+"&zxxjg="+zxxjg+"&xxjg="+xxjg+"&xxdays="+xxdays,function(){
                                alert('保存成功');
                                is_romm = true;
                          });


                     }else if(insertORupdate == 'update'){

                        var data = savedingfang(thisdingdans);//更新财务(订房)信息
                        if(!is_romm) return false;
                        $.post('updd.php',"addtype=dfcaiwu&bdid="+user_id+"&ddcode="+ddcode+"&zffs="+zffs+"&zxxjg="+zxxjg+"&xxjg="+xxjg+"&xxdays="+xxdays,function(){
                                alert('更新成功');
                                location.href='iframe.php?uid='+user_id;
                        });


                     }

                     break;

                     case '前台现付' :

                       var zxxjg = thisform.find('div[class=qtzf]').find('input[name=zxxjg]').val();
                       var xxjg  = thisform.find('div[class=qtzf]').find('input[name=xxjg]').val();
                       var xxdays = thisform.find('div[class=qtzf]').find('input[name=xxdays]').val();
                       if(!zxxjg){
                         alert('未填写价格');
                         return false;
                       }
                       var zxsjg = thisform.find('div[class=qtzf]').find('input[name=zxsjg]').val();
                       var xsjg  = thisform.find('div[class=qtzf]').find('input[name=xsjg]').val();
                       var xsdays = thisform.find('div[class=qtzf]').find('input[name=xsdays]').val();

                       var yj = thisform.find('div[class=qtzf]').find('input[name=yj]').val();
                       var kryf = thisform.find('div[class=qtzf]').find('input[name=kryf]').val();
                       var yk = thisform.find('div[class=qtzf]').find('input[name=yk]').val();


                       if(insertORupdate == 'insert'){

                           var data = savedingfang(thisdingdans);//保存财务(订房)信息
                           if(!is_romm) return false;
                           $.post('savedata.php',"addtype=dfcaiwu&bdid="+user_id+"&ddcode="+ddcode+"&zffs="+zffs+"&kryf="+kryf+"&yj="+yj+"&yk="+yk+"&zxxjg="+zxxjg+"&zxsjg="+zxsjg+"&xxjg="+xxjg+"&xxdays="+xxdays+"&xsjg="+xsjg+"&xsdays="+xsdays,function(){
                                  alert('保存成功');

                           });


                        }else if(insertORupdate == 'update'){

                            var data = savedingfang(thisdingdans);//更新财务(订房)信息
                            if(!is_romm) return false;
                            $.post('updd.php',"addtype=dfcaiwu&bdid="+user_id+"&ddcode="+ddcode+"&zffs="+zffs+"&kryf="+kryf+"&yj="+yj+"&yk="+yk+"&zxxjg="+zxxjg+"&zxsjg="+zxsjg+"&xxjg="+xxjg+"&xxdays="+xxdays+"&xsjg="+xsjg+"&xsdays="+xsdays,function(){
                                     alert('更新成功');
                                    location.href='iframe.php?uid='+user_id;
                            });


                        }


                     break;

                     case '定金支付' :
                       var zxxjg = thisform.find('div[class=djzf]').find('input[name=zxxjg]').val();
                       var xxjg  = thisform.find('div[class=qtzf]').find('input[name=xxjg]').val();
                       var xxdays = thisform.find('div[class=qtzf]').find('input[name=xxdays]').val();
                       if(!zxxjg){
                         alert('未填写价格');
                         return false;
                       }
                       var zxsjg = thisform.find('div[class=djzf]').find('input[name=zxsjg]').val();
                       var xsjg  = thisform.find('div[class=qtzf]').find('input[name=xsjg]').val();
                       var xsdays = thisform.find('div[class=qtzf]').find('input[name=xsdays]').val();

                       var yj = thisform.find('div[class=djzf]').find('input[name=yj]').val();
                       var djfs = thisform.find('div[class=djzf]').find('select[name=djfs]').val();
                       var ykfs = thisform.find('div[class=djzf]').find('select[name=ykfs]').val();
                       var djje = thisform.find('div[class=djzf]').find('input[name=djje]').val();
                       var ykje = thisform.find('div[class=djzf]').find('input[name=ykje]').val();

                       if(insertORupdate == 'insert'){

                           var data = savedingfang(thisdingdans);//保存财务(订房)信息
                           if(!is_romm) return false;
                           $.post('savedata.php',"addtype=dfcaiwu&bdid="+user_id+"&ddcode="+ddcode+"&zffs="+zffs+"&djfs="+djfs+"&ykfs="+ykfs+"&djje="+djje+"&ykje="+ykje+"&yj="+yj+"&zxxjg="+zxxjg+"&zxsjg="+zxsjg+"&xxjg="+xxjg+"&xxdays="+xxdays+"&xsjg="+xsjg+"&xsdays="+xsdays,function(){
                                   alert('保存成功');

                           });
                           //保存上次内容
                           var thisDataLishi = thisdingdans.html();
                               thisDataLishi = thisDataLishi.replace(/\&/ig,'');
                           $.post('savelishi.php','bdid='+user_id+'&ddcode='+ddcode+'&data='+thisDataLishi+"&rdtime="+Math.random());


                        }else if(insertORupdate == 'update'){

                            var data = savedingfang(thisdingdans);//更新财务(订房)信息
                            if(!is_romm) return false;

                            $.post('updd.php',"addtype=dfcaiwu&bdid="+user_id+"&ddcode="+ddcode+"&zffs="+zffs+"&djfs="+djfs+"&ykfs="+ykfs+"&djje="+djje+"&ykje="+ykje+"&yj="+yj+"&zxxjg="+zxxjg+"&zxsjg="+zxsjg+"&xxjg="+xxjg+"&xxdays="+xxdays+"&xsjg="+xsjg+"&xsdays="+xsdays,function(){
                                    alert('更新成功');
                                    location.href='iframe.php?uid='+user_id;
                            });


                        }


                     break;
                    }



                       creahtml(data);

           }



           	function creahtml(data){

                 var user = $('#ddss').html();
                 var tel = $('#ddzj').html();

                 var rcode = data[0];
                 var startdate = data[1];
                 var enddate = data[2];

                 var iDays = DateDiff(startdate,enddate);

                 var zt = $('#zt');
                 var start_add = zt.find('li[rcode='+rcode+'][date='+startdate+']');
                 start_add.html($('<div>').css({'background':bgcolor['kongfang']}).attr('tel',tel).html(user));

                 for(var i=1; i<iDays; i++){
                    start_add = start_add.next();
                    var div = $('<div>').css({'background':bgcolor['kongfang']}).attr('tel',tel).html(user);
                        start_add.html(div);
                 }
                 var this_html = '<div style="margin-left:23px;background:'+bgcolor['kongfang']+';" tel="'+tel+'">'+user+'</div>';

                 if(insertORupdate == 'insert'){
                    //html入库
                    $.post('savedata.php',"addtype=html&uid="+user_id+"&tt="+this_html+"&rcode="+rcode+"&startdate="+startdate+"&iDays="+iDays+"&ddcode="+ddcode,function(){
                    });
                    thisdingdans.find('input[name=bcdd]').hide();

                 }else if(insertORupdate == 'update'){
                    //html更新
                    $.post('updd.php',"addtype=html&uid="+user_id+"&tt="+this_html+"&rcode="+rcode+"&startdate="+startdate+"&iDays="+iDays+"&ddcode="+ddcode,function(){
                    });
                    thisdingdans.find('input[name=bcdd]').hide();

                 }



            }






           function savejieji(thisObj){

              var thisObj = $(thisObj);
              thisdingdans = thisObj.parent().parent().parent();


              var yddate = thisdingdans.find('input[name=yddate]').val();

              var jdate = thisdingdans.find('input[name=jdate]').val();
              var jtime = thisdingdans.find('input[name=jtime]').val();
              var jcode = thisdingdans.find('input[name=jcode]').val();
              var didian = thisdingdans.find('input[name=didian]').val();
              var sdate = thisdingdans.find('input[name=sdate]').val();
              var stime = thisdingdans.find('input[name=stime]').val();
              var scode = thisdingdans.find('input[name=scode]').val();
              var zxxjg = thisdingdans.find('input[name=zxxjg]').val();


               if(insertORupdate == 'insert'){
                     var ddcode = new Date().valueOf();
                     thisdingdans.find('span[name=ddcode]').html(ddcode);
                     $.post('savedata.php',"addtype=jieji&bdid="+user_id+"&yddate="+yddate+"&jdate="+jdate+"&jtime="+jtime+"&jcode="+jcode+"&didian="+didian+"&sdate="+sdate+"&stime="+stime+"&scode="+scode+"&zxxjg="+zxxjg+"&ddcode="+ddcode,function(){
                            alert('保存成功');
                     });



                     thisdingdans.find('input[name=bcdd]').hide();
               }else if(insertORupdate == 'update'){
                     var ddcode = $.trim(thisdingdans.find('span[name=ddcode]').html());
                     $.post('updd.php',"addtype=jieji&bdid="+user_id+"&yddate="+yddate+"&jdate="+jdate+"&jtime="+jtime+"&jcode="+jcode+"&didian="+didian+"&sdate="+sdate+"&stime="+stime+"&scode="+scode+"&zxxjg="+zxxjg+"&ddcode="+ddcode,function(){
                            alert('更新成功');
                            location.href='iframe.php?uid='+user_id;
                     });

                     thisdingdans.find('input[name=bcdd]').hide();

               }



           }





            function savejingdian(thisObj){

                 var thisObj = $(thisObj);
                 thisdingdans = thisObj.parent().parent().parent();



                 var yddate = thisdingdans.find('input[name=yddate]').val();

                 var tt = thisdingdans.find('select[name=tt]').val();
                 var date = thisdingdans.find('input[name=date]').val();
                 var time = thisdingdans.find('input[name=time]').val();
                 var num = thisdingdans.find('input[name=num]').val();
                 var zxxjg = thisdingdans.find('input[name=zxxjg]').val();



                 if(insertORupdate == 'insert'){

                      var ddcode = new Date().valueOf();
                      thisdingdans.find('span[name=ddcode]').html(ddcode);
                      $.post('savedata.php',"addtype=jingdian&bdid="+user_id+"&yddate="+yddate+"&tt="+tt+"&date="+date+"&time="+time+"&num="+num+"&ddcode="+ddcode+"&zxxjg="+zxxjg,function(){
                             alert('保存成功');
                      });

                      thisdingdans.find('input[name=bcdd]').hide();

                  }else if(insertORupdate == 'update'){

                      var ddcode = $.trim(thisdingdans.find('span[name=ddcode]').html());
                      $.post('updd.php',"addtype=jingdian&bdid="+user_id+"&yddate="+yddate+"&tt="+tt+"&date="+date+"&time="+time+"&num="+num+"&ddcode="+ddcode+"&zxxjg="+zxxjg,function(){
                            alert('更新成功');
                          location.href='iframe.php?uid='+user_id;
                      });

                      thisdingdans.find('input[name=bcdd]').hide();

                  }



           }

			/////////option 选项隐藏   IE下有问题、、、、、
           function selectRtype(thisObj){

                var thisObj = $(thisObj);
                var thisObj_text = thisObj.val();

                var selectRcode = $('select[name=rcode]');
                    selectRcode.find('option').each(function(i){
                        var thisObj = $(this);
                           if(thisObj.attr('rtype') == thisObj_text){
                               thisObj.css('display','block');
                               thisObj.attr('selected','selected');
                           }else{
                               thisObj.hide();
                           }
                    });
            }

            function DateDiff(sDate1, sDate2){

                                 var aDate = sDate1.split("-");
                                 var oDate1 = new Date(aDate[0],aDate[1]-1,aDate[2],0,0,0).getTime();

                                 var bDate = sDate2.split("-");
                                 var oDate2 = new Date(bDate[0],bDate[1]-1,bDate[2],0,0,0).getTime();

                                 var iDays = (oDate2 - oDate1)/1000/60/ 60/24+1;

                                 return iDays;
            }


			function closedd(){
				jQuery('.dingdan').fadeOut("normal")
			}



			function jiadan(){
				//jQuery('.dingdan').append('<ul><li class="protit">追加住房<input style="float:right;" name="" onClick="member.del(this);" type="button" value="X" /></li><li class="proct">房<span style="margin-left:26px;"></span>型：<span><select name=""><option>双标</option><option>大床单间</option><option>情侣间</option></select></span></li><li class="proct">房<span style="margin-left:26px;"></span>号：<span><input name="" type="text" size="4" /></span></li><li class="proct">入住日期：<span><input onfocus="WdatePicker();" name="" type="text" size="11" /></span></li><li class="proct">退房日期：<span><input onfocus="WdatePicker();" name="" type="text" size="11" /></span></li>	<li class="proct">预订人员：<span><input name="" type="text" size="11" /></span></li>	<li class="proct">处理人员：<span><input name="" type="text" size="11" /></span></li>	</ul>');
                var dingdans = $('.dingdans');
                var clone = dingdans.eq(0).clone();
                var del = $('<input style="float:left;" onclick="del(this);"  type="button" value="X" />');
                    clone.find('input[type=text][name!=chulimeb]').val('');
                    clone.find('span[name=ddcode]').empty();
                    clone.find('div[class=clear]').before(del);
                    clone.find('input[name=bcdd]').show();
				$('.dingdanct').append(clone);
			}


           //获取预订时间
           function get_time(obj){
               var time = new Date();
               var year = time.getYear();
               var year = year<1900?year+1900:year;
               var month = time.getMonth()+1;
               var day   = time.getDate();
               var hours  =  time.getHours();
               var hours = String(hours).length==1?'0'+String(hours):hours;
               var minutes = time.getMinutes();
               var minutes = String(minutes).length==1?'0'+String(minutes):minutes;
               var seconds = time.getSeconds();
               var seconds = String(seconds).length==1?'0'+String(seconds):seconds;
               var date = year+'-'+month+'-'+day+' '+hours+':'+minutes+':'+seconds;
               obj.value = date;

           }


			function jieji(){
				jQuery('.dingdanct').append('<div class="dingdans" style="margin:0 0 20px 0;"><p style=""><span>订单号:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span name="ddcode"></span></p><ul><li class="protit">接机送机&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="bcdd" onClick="savejieji(this);" type="button" value="保存" /></li><li class="proct">预订时间：<span><input onclick="get_time(this);" name="yddate" type="text" size="20" /></span></li><li class="proct" style="clear:left;">接 日 期 ：<span><input onfocus="WdatePicker();" type="text" name="jdate" size="10" /></span></li><li class="proct">抵达时间：<span><input type="text" name="jtime" size="8" /></span></li><li class="proct">航 班 号 ：<span><input type="text" name="jcode" size="15" /></span></li><li class="proct">到达地点：<span><input type="text" name="didian" size="8" /></span></li><li class="proct">送 日 期 ：<span><input onfocus="WdatePicker();" type="text" name="sdate" size="10" /></span></li><li class="proct">起飞时间：<span><input type="text" name="stime" size="8" /></span></li><li class="proct">航 班 号 ：<span><input type="text" name="scode" size="15" /></span></li><li class="proct">接/送费用：<span><input type="text" name="zxxjg" size="8" /></span></li></ul><input style="float:left;" onclick="del(this);"  type="button" value="X" /><div style="clear:both;"></div></div>')
			}


			function del(o){
				jQuery(o).parent().remove()
		    }


			function closewin(){
				jQuery('#flfoot').fadeOut('normal')
				jQuery('#flct').fadeOut('normal')
				jQuery('.yincang').fadeOut('normal')
				jQuery('.btser').fadeOut('normal')
				setTimeout(function(){jQuery('#flo').css('height','25px').css('width','228px').css('top','30px').css('left','900px')},80);
			}


			function openwin(){
				jQuery('#flfoot').fadeIn('normal')
				jQuery('#flct').fadeIn('normal')
				jQuery('.yincang').fadeIn('normal')
				jQuery('.btser').fadeIn('normal')
				jQuery('#flo').css('height','182px').css('width','480px')
			}

